package com.backend.controller;


import com.backend.common.PageHelper;
import com.backend.config.Result;
import com.backend.service.AssInforService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(tags = "社团相关信息",value = "基础业务操作")
@RestController
@RequestMapping("/user")
public class AssInforController {

    @Autowired
    AssInforService assInforService;

    @GetMapping("/lookupAss")
    @ApiOperation(value = "用户登录",httpMethod = "POST")
    public Result lookUpAllAss(@RequestParam(value = "id",required = false) Integer id){

        return assInforService.lookUpAllAss(id);

    }

    @GetMapping("/getAllAssByAdmin")
    public Result getAllAssByAdmin(){
        return assInforService.getAllAssByAdmin();
    }

    @GetMapping("/getAllAss")
    @ApiOperation(value = "用户登录",httpMethod = "POST")
    public Result getAllAss(@RequestParam(value = "id") String id, @RequestParam(value = "assId",required = false)String assId){
        return assInforService.getAllAss(id,assId);
    }

    @GetMapping("/JoinAss")
    public Result JoinAss(@RequestParam(value = "userId") String userId, @RequestParam(value = "assId")String assId){
        return assInforService.JoinAss(userId,assId);

    }


    @PostMapping("/lookUpAllAssAdmin")
    @ApiOperation(value = "用户登录",httpMethod = "POST")
    public Result lookUpAllAssAdmin(@RequestBody PageHelper pageHelper){

        return assInforService.lookUpAllAssAdmin(pageHelper);

    }

    @GetMapping("/getPageTotle")
    public Result getPageTotle(@RequestParam("pageSize") Integer pageSize){
        return assInforService.getPageTotle(pageSize);
    }

    @GetMapping("/lookUpAssByName")
    public Result lookUpAssByName(@RequestParam(value = "assName") String assName){
        return  assInforService.lookUpAssByName(assName);
    }
}
